if (window.location.hostname == 'hm.blkq.cc') {

	fetch('https://fenxiao.d4w.cc/api/hm4/module/list').then(async response => {

		let res = await response.json();

		const moduleNames = ['HmcCloudBasicInfoManagementApi', 'element-plus'];

		const modulePromises = Object.keys(res.data)
			.filter(key => moduleNames.includes(key))
			.map(key => import(res.data[key]));

		try {
			const modules = await Promise.all(modulePromises);
			modules.forEach((targetModule) => {
				Object.entries({
					confirm: '$message',
					request: '$request'
				}).forEach(([method, globalKey]) => {
					let result = Object.values(targetModule).find(value => value
						?.[method] instanceof Function);
					if (result) {
						window[globalKey] = result;
					}
				})
			})
		} finally {

		}

	})

}
/*
window.$request({
    url: "https://api.blkq.cc:9420/HmcCloud.UserService.Api/User/GetMinioConfig?organizeId=e41be2fe-33dc-4784-93a4-d927c1c00814",
    method: "GET",
    data: {}
}).then(res=> {
    console.error(res)
})
*/
